import request from '@/utils/request'
import type {
  loginPasswordReq,
  loginPasswordApi,
  codeGetReq,
  codeGetApi,
  loginPostReq,
  patientMyUserApi,
  patientMylistApi,
  patientAddReq,
  patientUpdateReq,
  loginBindingReq,
  loginThirdpartyReq
} from '@/types/user'
// 登录--密码登录
export const loginPassword = (data: loginPasswordReq) =>
  request<loginPasswordApi>('/login/password', 'post', data)
// 获取手机验证码
export const codeGet = (data: codeGetReq) => request<codeGetApi>('/code', 'get', data)
// 验证码登录
export const loginPost = (data: loginPostReq) => request<loginPasswordApi>('/login', 'post', data)
// 我的-获取个人用户信息
export const patientMyUser = () => request<patientMyUserApi>('patient/myUser')

// 问诊-查询患者列表信息
export const patientMylist = () => request<patientMylistApi[]>('patient/mylist')

// 问诊-添加患者信息
export const patientAdd = (data: patientAddReq) => request('patient/add', 'post', data)

// 问诊-编辑患者信息
export const patientUpdate = (data: patientUpdateReq) => request('/patient/update', 'put', data)

// 问诊-删除患者信息
export const patientDel = (id: string) => request(`/patient/del/${id}`, 'delete')

// 登录--绑定用户新-三方登录绑定手机号
export const loginBinding = (data: loginBindingReq) =>
  request<loginPasswordApi>('/login/binding', 'post', data)

// 登录--三方登录--qq三方登录
export const loginThirdparty = (data: loginThirdpartyReq) =>
  request<loginPasswordApi>('/login/thirdparty', 'post', data)
